package com.junyuan.gsp.shiro;

import com.auth0.jwt.JWT;
import com.auth0.jwt.interfaces.DecodedJWT;
import org.apache.shiro.authc.AuthenticationToken;

/**
 * @Author: maxwellens
 */
public class JwtToken implements AuthenticationToken
{
    private String token;

    public JwtToken(String token)
    {
        this.token = token;
    }

    @Override
    public Object getPrincipal()
    {
        return token;
    }

    @Override
    public Object getCredentials()
    {
        return token;
    }

    public DecodedJWT getJWT()
    {
        return JWT.decode(token);
    }

    public String getToken()
    {
        return token;
    }
}